﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Eventing.Reader;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PeopleTV
{
    class RemoteControl
    {
        TV _changingTv = new TV();
    
        public ConsoleKeyInfo PressingButton = Console.ReadKey();
    
        public RemoteControl()
        {
            BatteryVolume = 1000;
        
        }

       

        public void TurnTheTv()
        {
            _changingTv.PressPower();
        }

        public void IncreaseLevelOfVolume()
        {
            if (BatteryVolume >0)
            {
               _changingTv.PressButtonOfVolumeUp();
                BatteryVolume--;
            }
            else
            {
                Console.WriteLine("Please, change your battery");
            }
        }

        public void ReductionLevelOfVolume()
        {
            if (BatteryVolume>0)
            {
                _changingTv.PressButtonOfVolumeDown();
                BatteryVolume--;
            }
            else
            {
                Console.WriteLine("Please, change your battery");
            }
        }

        public void ChangeChannelUp()
        {
            if (BatteryVolume>0)
            {
                _changingTv.PressButtonOfChannelUp();
                BatteryVolume--;
            }
            else
            {
                Console.WriteLine("Please, change your battery");
            }
        }

        public void ChangeChannelDown()
        {
            if (BatteryVolume>0)
            {
                _changingTv.PressButtonOfChannelDown();
                BatteryVolume--;
            }
            else
            {
                Console.WriteLine("Please, change your battery");
            }
 
        }

        public void CheckTurnOnTv()
        {
            if (PressingButton.Key == ConsoleKey.Spacebar)
            {
                _changingTv.PressPower();
            }
        }

        public void CheckChangeChannelUp()
        {
            if (PressingButton.Key == ConsoleKey.UpArrow)
            {
                _changingTv.PressButtonOfChannelUp();
            }
        }

        public void CheckChangeChannelDown()
        {
            if (PressingButton.Key == ConsoleKey.DownArrow)
            {
                _changingTv.PressButtonOfChannelDown();
            }
        }

        public void CheckChangeVolumeLevelLeft()
        {
            if (PressingButton.Key == ConsoleKey.LeftArrow)
            {
                _changingTv.PressButtonOfVolumeDown();
            }
        }
        public void CheckChangeVolumeLevelRight()
        {
            if (PressingButton.Key == ConsoleKey.RightArrow)
            {
                _changingTv.PressButtonOfVolumeUp();
            }
        }

        public void CheckAllButtons()
        {
            CheckTurnOnTv();
            CheckChangeChannelDown();
            CheckChangeChannelUp();
            CheckChangeVolumeLevelLeft();
            CheckChangeVolumeLevelRight();
        }


        public int BatteryVolume { get; set; }
    }
}
